package com.cheyun.netsalev3.adapter

import android.content.Context
import android.content.Intent
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.cheyun.netsalev3.databinding.OverdueItemBinding
import com.cheyun.netsalev3.view.defeatdetails.DefeatDetailsActivity

/**
 * @author Michael
 * @date  2018/11/2 - 15:23.
 */
class OverdueAdapter : RecyclerView.Adapter<OverdueAdapter.ViewHolder>() {
    lateinit var content: Context
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        content = parent.context
        return ViewHolder(OverdueItemBinding.inflate(LayoutInflater.from(parent.context), parent, false))
    }

    override fun getItemCount(): Int = 10

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        holder.apply {
            binding.root.setOnClickListener {
                content.startActivity(Intent(content, DefeatDetailsActivity::class.java))
            }
        }
    }

    class ViewHolder(var binding: OverdueItemBinding) : RecyclerView.ViewHolder(binding.root) {

    }
}
